package common.files.flatfile;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class FlatFileCommon {
	
	protected String filename;
	public File readfile;
	protected InputStream instream;

	@SuppressWarnings("unused")
	private FlatFileCommon() {
		super();
	}
	
	public FlatFileCommon(String filename) throws FileNotFoundException{
		this.filename = filename;
		this.openfile();
	}


	public void openfile() throws FileNotFoundException {
		this.readfile = new File(this.filename);
		this.instream = new FileInputStream(this.readfile);
	}

	public void openfile(String filename) throws FileNotFoundException {
		this.setFilename(filename);
		this.openfile();
	}

	public String getFilename() {
		return filename;
	}

	public void setFilename(String filename) {
		this.filename = filename;
	}

	public InputStream getInstream() {
		return instream;
	}
	
	public void close() throws IOException{
		this.instream.close();
	}

}